During the process of network communications, if the data traffic sent from users is not limited, then the continuous burst of data sent from a great many users will lead to network congestion. Immoderate congestion will cause a severe hazard to network resources and therefore must be removed. Congestion avoidance is a traffic control mechanism by means of which the usage of network resources can be monitored and a network overload can be eliminated by adjusting the traffic of the network, for example, by actively discarding packets in the case of network congestion. When discarding packets, a device maximizes the throughput and the utilization efficiency of a network and at the same time minimizes the number of the packets discarded and the delay of packet discarding by using an effective combination of a specific packet discarding policy and a remote traffic control mechanism.
In related art, packet congestion processing is carried out in a network processor mainly by using a Weighted Random Early Detection (WRED) algorithm. In this method, a discarding probability is mainly determined by comparing an average queue size with a set upper limit and lower limit of the average queue size, wherein the average queue size is the function of queue size which reflects the variation trend of a queue. When determining whether or not to discard a packet, the method first acquires the queue size of packets having the same queue number, calculates the average queue size using a corresponding algorithm, and then determines the discarding probability by comparing the average queue size with the set upper limit and set lower limit of the average queue size. High energy consumption and a relatively long waiting time are unavoidable when a packet discarding processing is carried out using this method which requires for the acquisition of the packet size of the current packet prior to the calculation of a queue size corresponding to the packet for the following reason: as the packet is transmitted to a network processor in the form of packet fragments, to obtain the size of the current packet, it is needed to store the packet fragments using a Random Access Memory (RAM) until the entire packet is received to acquire the size of the packet without which a congestion processing cannot be carried out. As network processors provide more and more interfaces, and the packet fragments at different interfaces are generally interwoven, RAM resource is consumed in proportion to the number of interfaces in this method. The consumption of RAM resource is unacceptable when the number of interfaces is beyond a certain range.